home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 050a.dms / 050a.adf / TEXTS / chapter24.txt < prev    next >
Text File  |  1992-02-26  |  4KB  |  98 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                              Chapter Twenty Four
  4.                             ----------------------
  5. We shall now take a look at a few more commands concerning colour.
  6.  
  7. The COLOUR command seems a bit daunting at first, but like most of the Amos
  8. command set it soon becomes fairly straightforward if you spend a little time
  9. studying it.
  10.  
  11. When you first load Amos the screen COLOURs are set to default. If you press
  12. escape you will see the infamous yukky brown we all love to hate.
  13. Wouldn't it be nice if we could change them default colours without
  14. resorting to loading a picture or bob bank!  As you can guess it's all
  15. possible in good old Amos. The default screen is a sixteen colour screen.
  16. The COLOUR numbers run from 0 to 15. These 16 numbers are commonly known as
  17. colour indexes. The first colour index (0) is black and the second COLOUR 
  18. index (1) is the horrid brown. If were to enter the following line we could 
  19. change that brown to blue:
  20.  
  21.  
  22.  
  23. COLOUR 1,$00F  ----|
  24.        |           |
  25.        |           |
  26.   Colour index     |
  27.                    |
  28.                    |
  29.                RGB values
  30.  
  31.  
  32.  
  33. The 1 is easy, it's the COLOUR index (or number if you wish) If we wanted to
  34. change the black (COLOUR 0) we would of put 0 instead of 1.
  35.  
  36. I am going to have explain the second part. The $00F part is commonly known
  37. as an RGB value. You may have come across this in a Paint package such as
  38. Dpaint 3. RGB stands for Red, Green and Blue. You have to assign a value to
  39. each of these primary colours which Amos will then mix for you into a
  40. COLOUR. The range of the values are in a format called Hexadecimal. I am not
  41. going to explain the ins and outs of hex here I will just give you a simple
  42. chart:
  43.  
  44.   HEX DIGIT    1 2 3 4 5 6 7 8 9 A  B  C  D  E  F
  45.  
  46.     DECIMAL    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  47.  
  48. So from the chart you can see that the maximum value you can use is F (15)
  49. which is the brightest available of the primary colour it is assigned to. 
  50. We assigned $F to B (blue) and 0 to R and 0 to G that works out as :
  51.  
  52. NO RED    NO GREEN     MAXIMUM BLUE
  53.  
  54. Example24.Amos is a palette requestor routine written by a clever chap
  55. called Rob Farnsworth. I have included it here as it allows you to see the 
  56. RGB values of colours and anyway it's a superbly written program. 
  57. Load it now!
  58.  
  59. As seen in Rob's routine you can use the HEX$ instruction to read the COLOUR
  60. assignment of any index:
  61.  
  62. PRINT HEX$(COLOUR(1))
  63.  
  64. Would now return our blue (00F) So if we wanted to put back that horrid 
  65. brown, which incidentally is $A40, all we have to do is:
  66.  
  67. COLOUR 1,$A40
  68.  
  69. and we are back to normal.
  70.  
  71. Now we move on to the PALETTE instruction which is really just a more
  72. powerful version of COLOUR. PALETTE allows you to set as many COLOUR
  73. commands as you want in one statement. Very handy if you want to change a lot
  74. of colours in one go:
  75.  
  76. PALETTE $FFF,$00F
  77.  
  78. Would change COLOURs zero and one. PALETTE is quite flexible, you can insert
  79. a comma (,) to skip any COLOUR you do not want to change so if for example
  80. we wanted to change COLOURs 0,1 and 6 we would do  this:
  81.  
  82. PALETTE $FFF,$00F,,,$0F0,,,,,,,,,
  83.           |       |   |
  84.           |       |   |
  85.        COLOUR 0   | COLOUR 6,NOW GREEN    
  86.        NOW WHITE  |
  87.                   |
  88.                COLOUR 4
  89.             STAYS AS IT WAS
  90.        AS DO 3 & 5 & 7 ONWARD 
  91.   
  92. To save confusing you I have been putting leading zeros in the RGB values. 
  93. If you put $000 in your Amos listing it will be changed to just $0 for you 
  94. so don't worry if this happens.  Now load Example24.Amos.
  95.  
  96.                               End of Chapter 24
  97.                               ^^^^^^^^^^^^^^^^^
  98.